home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / uim / init.scm < prev    next >
Encoding:
Text File  |  2010-11-07  |  4.3 KB  |  132 lines

  1. ;;;
  2. ;;; Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
  3. ;;;
  4. ;;; All rights reserved.
  5. ;;;
  6. ;;; Redistribution and use in source and binary forms, with or without
  7. ;;; modification, are permitted provided that the following conditions
  8. ;;; are met:
  9. ;;; 1. Redistributions of source code must retain the above copyright
  10. ;;;    notice, this list of conditions and the following disclaimer.
  11. ;;; 2. Redistributions in binary form must reproduce the above copyright
  12. ;;;    notice, this list of conditions and the following disclaimer in the
  13. ;;;    documentation and/or other materials provided with the distribution.
  14. ;;; 3. Neither the name of authors nor the names of its contributors
  15. ;;;    may be used to endorse or promote products derived from this software
  16. ;;;    without specific prior written permission.
  17. ;;;
  18. ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
  19. ;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. ;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. ;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
  22. ;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. ;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. ;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. ;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. ;;; SUCH DAMAGE.
  29. ;;;;
  30.  
  31. ;; This file initializes platform dependent execution
  32. ;; environment. Following codes are written for ordinary UNIX desktop
  33. ;; system. Modify this file with careful investigation to change uim
  34. ;; configuration for special platforms such as embedded environments
  35. ;;   -- YamaKen 2005-01-29
  36.  
  37. (require-extension (srfi 23 34 60) (siod))
  38.  
  39. ;; Disable SIOD compatibilities.
  40. (undefine the-environment)
  41. (undefine bit-and)
  42. (undefine bit-or)
  43. (undefine bit-xor)
  44. (undefine bit-not)
  45.  
  46. (let ((vlevel (getenv "LIBUIM_VERBOSE")))
  47.   (if (and vlevel
  48.        (not (setugid?)))
  49.       (guard (err (else #f))
  50.     (verbose (string->number vlevel)))))
  51.  
  52. (define enable-action? #t)
  53.  
  54. ;; SIOD compatibility for SigScheme
  55. (if (not (symbol-bound? 'allocate-heap))
  56.     (eval '(define allocate-heap
  57.          (lambda ()
  58.            (%%prealloc-heaps 0)))
  59.       (interaction-environment)))
  60.  
  61. ;; Performance tuning for heavy job such as custom.scm. The value 64
  62. ;; allocates approximately 8MB of heaps. Reduce it for less-memory
  63. ;; environment (by redefining the proc in ~/.uim or default.scm).
  64. ;;   -- YamaKen 2005-02-01, 2007-01-08
  65. (define prealloc-heaps-for-heavy-job
  66.   (lambda ()
  67.     (%%prealloc-heaps 64)))
  68.  
  69. (define load-user-conf
  70.   (lambda ()
  71.     (let ((home-dir (or (home-directory (user-name)) "")))
  72.       (if (or
  73.        (setugid?)
  74.        (not home-dir))
  75.       #f
  76.       (let ((orig-verbose (verbose))
  77.             (file (or (getenv "LIBUIM_USER_SCM_FILE")
  78.               (string-append home-dir "/.uim"))))
  79.         (if (>= (verbose)
  80.             1)
  81.         (verbose 1))
  82.         (let ((succeeded (try-load file)))
  83.           (verbose orig-verbose)
  84.           succeeded))))))
  85.  
  86. (define load-modules
  87.   (lambda ()
  88.     (if (not (memq 'direct enabled-im-list))
  89.     (set! enabled-im-list (append enabled-im-list '(direct))))
  90.  
  91.     (let ((vanilla (getenv "LIBUIM_VANILLA")))
  92.       (cond
  93.        ;; vanilla + toppings:
  94.        ;; disable ~/.uim, user customs and lazy loading, but enable loading
  95.        ;; modules
  96.        ((equal? vanilla "2")
  97.     (set! enable-lazy-loading? #f)
  98.     (load-enabled-modules))
  99.  
  100.        ;; pure vanilla:
  101.        ;; disable ~/.uim, user customs, lazy loading, loading modules
  102.        (vanilla    ;; "1", legacy "0", and so on
  103.     (set! enable-lazy-loading? #f))
  104.  
  105.        ;; fully flavored:
  106.        ;; enable ~/.uim, user customs, lazy loading if required, and loading
  107.        ;; modules
  108.        (else
  109.     (if enable-lazy-loading?
  110.         (require "lazy-load.scm"))
  111.     (load-enabled-modules))))
  112.  
  113.     ;; must be loaded at last of IMs
  114.     (if (not (retrieve-im 'direct))
  115.     (require-module "direct"))))
  116.  
  117. (require "plugin.scm")
  118. (require "custom-rt.scm")
  119. (require "key.scm")
  120. (require "im.scm")
  121.  
  122. (load-module-conf)
  123. (require-custom "im-custom.scm")
  124. (load-modules)
  125.  
  126. (if (symbol-bound? 'uim-notify-load)
  127.     (uim-notify-load (symbol->string notify-agent)))
  128.  
  129. (or (getenv "LIBUIM_VANILLA")
  130.     (load-user-conf)
  131.     (load "default.scm"))
  132.